﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Vit.Web.Models
{
    public static class ProfileExtensions
    {
        public static string GetProfileValue(this IEnumerable<Profile> profiles, string profileName, string defaultValue)
        {
            if (profiles != null && profiles.Count() > 0)
            {
                var profile = profiles.FirstOrDefault(o => string.Equals(o.Name, profileName, StringComparison.OrdinalIgnoreCase));
                if (profile != null)
                    return profile.Value;
            }
            return defaultValue;
        }
    }
}
